//
//  SerOrderDetailPackageCell.m
//  BaseProject
//
//  Created by 王洋 on 2020/7/30.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "SerOrderDetailPackageCell.h"

@implementation SerOrderDetailPackageCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)fillCellWithModel:(CommonOrderDetailModel *)model {
    
    self.storeName.text = model.uodSellerName;
    
    CommonOrderGoodsModel *goodsModel = model.userOrderGoodsVoList.firstObject;
    self.packageName.text = goodsModel.ogGoodsName;
    self.packagePrice.text =[NSString stringWithFormat:@"¥%@",[Utilities changeDoubleToString:goodsModel.ogTotal]];
    
    [self.mainImageView sd_setImageWithURL:[NSURL URLWithString:goodsModel.specImage] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    
    switch (model.uodStatus) {
        case SerCellOrderType_payDJ:{
            self.orderStatusLab.text = @"等待支付定金";
        } break;
        case SerCellOrderType_waitPay:{
            self.orderStatusLab.text = @"等待支付全款";
        } break;
        case SerCellOrderType_payWK:{
            self.orderStatusLab.text = @"等待支付尾款";

        } break;
        case SerCellOrderType_recOrder:{
            self.orderStatusLab.text = @"等待商家接单";

        } break;
        case SerCellOrderType_service:{
            self.orderStatusLab.text = @"等待商家服务";

        } break;
        case SerCellOrderType_serviced:{
            self.orderStatusLab.text = @"商家已服务";

        } break;
        case SerCellOrderType_serviceSure:{
            self.orderStatusLab.text = @"等待用户确认完成";

        } break;
        case SerCellOrderType_evaluate:{
            self.orderStatusLab.text = @"待评价";

        } break;
        case SerCellOrderType_finish:{
            self.orderStatusLab.text = @"已完成";

        } break;
        case SerCellOrderType_cancle:{
            self.orderStatusLab.text = @"取消订单";

        } break;
        case SerCellOrderType_sysClose:{
            self.orderStatusLab.text = @"系统自动关闭";

        } break;
        default:{
          
            self.orderStatusLab.text = @"未知状态";
        } break;
    }
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self.mainImageView pp_clipCorners:UIRectCornerAllCorners radius:6];
    });
}

@end
